1. Field of the Invention
The present invention relates to a computer system having non-volatile memory for storing sequences of instructions for execution by a processor in the computer system, and more particularly to fault-tolerance techniques for in-circuit programming to update and modify sequences of instructions stored in non-volatile memory.
The present invention further relates to integrated circuits having a non-volatile memory for storing sequences of instructions for execution by a processor on the integrated circuit; and more particularly to techniques for accomplishing in-circuit programming to update and modify the stored sequences of instructions.
2. Related Art
Integrated circuit microcontrollers have been developed which include arrays of non-volatile memory on an integrated circuit for storing sequences of instructions to be executed by a microcontroller. The sequences of instructions are stored in read-only memory (ROM), which must be programmed during manufacture of a device, and cannot be updated. The sequences of instructions can also be stored in an EPROM array. However, this approach requires special hardware to program the EPROM array before the device is placed in a circuit. In yet other systems, EEPROM memory is used for storing instructions. EEPROM has the advantage that it can be programmed much more quickly than EPROM, and can be modified on the fly. In yet another approach, flash memory is used to store instructions. This allows for higher density and higher speed reprogramming of the non-volatile memory. When a device combines a reprogrammable non-volatile memory, such as EEPROM or a flash memory, with a microcontroller, the device can be reprogrammed while it is in a circuit, allowing for in-circuit programming based on interactive algorithms.
The ability to interactively download instruction and data to a remote device can be very valuable in a network environment. For example, a company can service a customer's equipment without requiring the customer to bring the equipment to a service center. Rather, the company can execute diagnostic functions using the in-circuit programming capability of the customer's equipment across a communication channel such as the Internet or telephone lines. In this way, software fixes can be downloaded to a customer's equipment, and the equipment can be reenabled with corrected or updated code.
Example prior devices which include this capability include the AT89S8252 microcontroller, manufactured by Atmel of San Jose, Calif., and the P89CE558 single chip microcontroller, manufactured by Philips Semiconductors of Eindhoven, The Netherlands. According to the architecture of the Philips P89CE558 microcontroller, mask ROM is utilized for the in-circuit programming (ICP) set of instructions, which are used by the microcontroller to update flash memory on the chip. Thus, the Philips microcontroller requires a dedicated mask ROM module to store fixed ICP code for each individual environment. In order to adapt the ICP code for a particular environment, the environment must be known before manufacturing of the device is complete so that the mask ROM can be properly coded. Furthermore, the ICP communication channel is fixed to a serial RS232 port in the Philips microcontroller. This limits the use of the microcontroller to a relatively narrow range of applications, and makes it difficult to utilize the ICP function in a dynamic communication environment, where the serial port may not match well with the communication channel across which the updated software is provided.
According to the architecture of the Atmel AT89S8252 microcontroller, a dedicated serial peripheral interface (SPI) port on the chip is used for the updating of flash memory. This SPI port has the disadvantage that it is implemented with inflexible program logic; modification of the in-circuit programming technique cannot be accomplished because of the inflexibility of the SPI port. The Atmel chip has further disadvantages; complicated hardware must be added to the chip for handshaking with the ICP initiator and emulating the erase/program/verify wave forms for the flash memory; the SPI bus is not always the best choice for diverse system applications; extra system logic is required to modify the original reset circuits, which are used by the in-circuit programming algorithms; and complex SPI driver and receiver logic must be attached to the chip.
Reliability can become a problem during in-circuit programming. The in-circuit programming process can take up to ten minutes, during which time there may be data transmission errors or recording errors. These errors can be especially troubling if the code which performs the communication with the outside world (handshaking code) is itself modified during the in-circuit programming process. If this code gets corrupted, the in-circuit programming module may be left without any way of resetting itself or communicating with the outside world.
What is needed is a method for providing fault-tolerance during in-circuit programming which can recover from an error during the in-circuit programming process, even if the code used by the in-circuit programming process to communicate with the outside world is improperly programmed.
Accordingly in-circuit programming structures have been developed which rely on flash memory or other dynamically alterable non-volatile memory. However, prior art approaches have been inflexible in the in-circuit algorithms used. Thus, in dynamic networking environments where communication requirements can change, and applications of devices using the in-circuit programming can proliferate through a wide variety of circumstances, it's desirable to provide more flexible in-circuit programming capability. Furthermore, the in-circuit programming capability must insure that no instructions are lost during the in-circuit programming process, even if the power is turned off during the process. The technique must allow for interactive communication with a remote partner to accomplish the in-circuit programming process. These techniques must be available over a wide variety of media, including the Intel/Microsoft/Digital standard Universal Serial Bus (USB), the Philips Electronics/Computer Access Technology standard Access Bus, the Apple Computer/IBM/AT&T standard Geoport, the Apple Computer/Texas Instruments/NCR standard 1349 FireWire, the Internet, a serial port (such as RS232), and other environments.
Thus, it is desirable to provide more flexible in-circuit programming structures for use with integrated circuits.
There is also a need for an architecture for in-circuit programming which maintains flexibility in the in-circuit programming process while minimizing the amount of silicon real estate occupied by the flash memory used to implement the in-circuit programming functions.